<template>
  <!-- 回款 -->
  <el-table :data="collectList" style="width: 100%">
    <el-table-column prop="repaymentNum" label="回款编号" width="250" />
    <el-table-column prop="paymentName" label="回款名称" width="400" />
    <el-table-column prop="money" label="回款金额" width="250" />
    <el-table-column prop="repaymentName" label="回款方式" width="200" />
    <el-table-column prop="repaymentTime" label="回款日期" width="300" />
    <el-table-column prop="remark" label="备注" min-width="200" />
  </el-table>
</template>

<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'collectList',
  data () {
    return {
      collectList: [],
      typeList: []
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => { return [] }
    }
  },
  watch: {
    list (val) {
      if (val) {
        this.collectList = val
        this.typeList.forEach(item => {
          this.collectList.map(q_item => {
            if (q_item.repaymentType == item.value) {
              q_item.repaymentName = item.name
            }
          })
        })
      }
    }
  },
  mounted () {
    this.getRepaymentType()
  },
  methods: {
    // 获取回款方式
    async getRepaymentType () {
      let data = await queryTypeByDic('payment')
      this.typeList = data
    }
  }
}
</script>

<style>
</style>